<template>
  <div class="recommend">
    <h2>为你推荐</h2>
    <div class="container">
      <div class="wrapper">
        <div class="item" v-for="(item,index) in Items" :key="index"
            :class="{active: index === selected}"
            @mouseenter="selected = index" @mouseleave="selected = ''"
          >
          <a :href="item.link">
            <img :src="item.imgUrl">
          </a>
          <p class="title">{{item.title}}</p>
          <p class="text">{{item.text}}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      selected: '',
      Items: [
        {title: '北京大学', text: '434人好评', imgUrl: './static/img/BD.jpg', link: 'https://www.pku.edu.cn/'},
        {title: '清华大学', text: '6456人好评', imgUrl: './static/img/QH.jpg', link: 'https://www.tsinghua.edu.cn/'},
        {title: '上海大学', text: '5405人好评', imgUrl: './static/img/SHD.jpg', link: 'https://www.shu.edu.cn/'},
        {title: '河北大学', text: '2059人好评', imgUrl: './static/img/HD.jpg', link: 'https://www.hbu.edu.cn/'},
        {title: '河北地质大学', text: '9431人好评', imgUrl: './static/img/HDA.jpg', link: 'http://www.hgu.edu.cn/'}
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.recommend{
  width: 1226px;
  margin: 0 auto;
  background: #f5f5f5;
  padding-top: 60px;
  h2{
    font-size: 22px;
    font-weight: 200;
    line-height: 58px;
    color: #333;
  }
  .container{
    width: 1226px;
    margin: 0 auto;
    .wrapper{
      display: flex;
      justify-content: space-between;
      align-content: space-between;
      .active{
        box-shadow: 0 15px 30px rgba(0,0,0,0.1);
        margin-top: -1px;
        transition: all .2s linear;
      }
      .item{
        position: relative;
        overflow: hidden;
        height: 300px;
        width: 234px;
        color: #333;
        background: #fff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        >a>img{
          width: 150px;
          height: 150px;
        }
        .title{
          margin-top: 10px;
          font-size: 20px;
          font-weight: 400;
          margin-bottom: 15px
        }
        .text{
          color: #ff6709;
        }
        .price{
          color: #ff6709;
          font-size: 14px;
          margin-top: 10px;
          margin-bottom: 15px;
        }
      }
    }
  }
}
</style>
